package com.gufe.controller.user.prereserve;

import com.gufe.dto.prereserve.BasicInfoDTO;
import com.gufe.dto.prereserve.MilitaryInfoDTO;
import com.gufe.dto.prereserve.RetiredInfoDTO;
import com.gufe.dto.prereserve.StudyExperienceInfoDTO;
import com.gufe.entity.StudyExperienceInfo;
import com.gufe.result.Result;
import com.gufe.service.user.prereserve.SaveInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

// 对小程序端传递过来的预储信息进行存储
@RestController
@Slf4j
@RequestMapping("/api/user/prereserve")
public class SaveInfoController {

    @Autowired
    private SaveInfoService saveInfoService;

    /**
     * 存储预储基本信息
     * @param basicInfoDTO
     * @return
     */
    @PostMapping("/basic-info")
    public Result saveBasicInfo(@RequestBody BasicInfoDTO basicInfoDTO) {
        log.info("存储基本信息：{}",basicInfoDTO);
        saveInfoService.saveBasicInfo(basicInfoDTO);
        return Result.success("预储管理——基本信息保存成功...");
    }

    @PostMapping("/military-info")
    public Result saveMilitaryInfo(@RequestBody MilitaryInfoDTO militaryInfoDTO) {
        log.info("存储基本信息：{}",militaryInfoDTO);
        saveInfoService.saveMilitaryInfo(militaryInfoDTO);
        return Result.success("预储管理——军事社团信息保存成功...");
    }

    @PostMapping("/retired-info")
    public Result saveRetireInfo(@RequestBody RetiredInfoDTO retiredInfoDTO) {
        log.info("存储退役信息：{}",retiredInfoDTO);
        saveInfoService.saveRetiredInfo(retiredInfoDTO);
        return Result.success("预储管理——退役信息保存成功...");
    }
    @PostMapping("/study-info")
    public Result saveStudyInfo(@RequestBody StudyExperienceInfoDTO studyExperienceInfoDTO) {
        log.info("存储学习经历信息：{}",studyExperienceInfoDTO);
        saveInfoService.saveStudyInfo(studyExperienceInfoDTO);
        return Result.success("预储管理——学习经历信息保存成功...");
    }

}
